package com.yitiao.data_algorithms.structure.stack;

public class ArrayStack<E> implements Stack<E>{
    // 自定义动态数组
    Array<E> array;

    // 构造器
    public ArrayStack(int capacity) {
        array=new Array<E>(capacity);
    }

    public ArrayStack() {
        array=new Array<E>();
    }

    @Override
    public void push(E e) {
        array.addLast(e);
    }

    @Override
    public E peek() {
        return array.get(array.getSize()-1);
    }

    @Override
    public E pop() {
        return array.removeLast();
    }

    @Override
    public int getSize() {
        return 0;
    }
}
